#ifndef UDPHANDLER_H
#define UDPHANDLER_H

#include <QObject>
#include <QUdpSocket>
#include "udpdata.h"

class UdpHandler : public QObject
{
    Q_OBJECT

public:
    UdpHandler(QObject *parent = nullptr);
    ~UdpHandler();

    void startListening(QHostAddress &address, quint16 port);
    void stopListening();
    void startListen();

signals:
    void dataReceived(const FlightData &data, const QHostAddress &address, quint16 port);

private slots:
    void readData();

private:
    QUdpSocket *socket;
    udpdata *sigprocess ;
    const QHostAddress address = QHostAddress("192.168.168.45");
    const quint16 port = 12345; // 固定端口
};


#endif // UDPHANDLER_H
